package com.qf.domain;

import java.util.List;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
public class PageBean {
    //当前页码 -- 应该是从前端获取
    private int pageNum;
    //每页条数 -- 应该是从前端获取
    private int pageSize;
    //总条数 --- 数据库查询
    private long totalCount;
    //总页数 --- 算
    private int totalPage;
    //要展示的数据 -- 数据库查询
    private List data;
    //起始页
    private int startPage = 1;
    //最后一页的页码 总页数
    private int endPage;


    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(long totalCount) {
        this.totalCount = totalCount;
    }

    public int getTotalPage() {
        //总页数
        this.totalPage = (int)Math.ceil(totalCount * 1.0 / pageSize);
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
    }

    public int getStartPage() {
        return startPage;
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public int getEndPage() {
        this.endPage = (int)Math.ceil(totalCount * 1.0 / pageSize);
        return endPage;
    }

    public void setEndPage(int endPage) {
        this.endPage = endPage;
    }


}
